#ifndef _FM_API_H_
#define _FM_API_H_

#include "config.h"

#ifdef __IAR_SYSTEMS_ICC__

bool init_fm_rev(void);
bool set_fre(u8);
void fm_rev_powerdown(void);
void save_fre(u16 fre);
void fm_module_mute(u8 flag);
void fm_set_ch(u8 db);

u8 get_total_mem_channel(void);
#if(MIN_FRE==640)
u16 get_fre_via_channle(u8 channel);
#else
u8 get_fre_via_channle(u8 channel);
#endif
#if (MIN_FRE==640)
u8 get_channel_via_fre(u16 fre);
#else
u8 get_channel_via_fre(u8 fre);
#endif
#if(MIN_FRE==640)
void save_fm_point(u16 fre);
#else
void save_fm_point(u8 fre);
#endif
void clear_all_fm_point(void);
void ch_save(void);
void fm_scan_flag(bool flag);
void fm_info_init(void);
u8 fm_scan_msg(void);
bool fm_scan(u8 mode);
void RDA5807P_SetVolumeLevel(u8 level);
#ifdef  FM_INDEPENDENT_ADJ_VOL
void FM_Chip_Set_Vol(u8 fm_vol);
#endif

#endif  /*  __IAR_SYSTEMS_ICC__ */

#define FM_CUR_FRE          0
#define FM_FRE_DEC          1
#define FM_FRE_INC		2

#define FM_SCAN_STOP        0
#define FM_SCAN_PREV        1
#define FM_SCAN_NEXT		2
#define FM_SCAN_ALL         3

#define MAX_FRE    1080
#ifndef  MIN_FRE
#define MIN_FRE	   875
#endif
#define MAX_CHANNL (MAX_FRE - MIN_FRE + 1)

#ifdef  ENABLE_AM
#ifdef USE_BK1088_FM
#define MAX_FRE_AM    1710
#define MIN_FRE_AM	   522
#else
#define MAX_FRE_AM    1710
#define MIN_FRE_AM	   504
#endif
#endif

#define MAX_CHANNL_AM (MAX_FRE_AM- MIN_FRE_AM)/MW_CHANNEL_STEP+1


#ifdef  USE_RDAs_FM
#define RDA5807      1
#else
#define RDA5807      0
#endif
#ifdef  USE_CL6017G_FM
#define CL6017G      1
#else
#define CL6017G      0
#endif
#ifdef  USE_BK1080_FM
#define BK1080       1
#else
#define BK1080       0
#endif
#ifdef  USE_KT0830_FM
#define KT0830EG     1
#else
#define KT0830EG     0
#endif
#ifdef  USE_QN8035_FM
#define QN8035       1
#else
#define QN8035       0
#endif
#ifdef USE_AR1019_FM
#define AR1019    1
#else
#define AR1019    0
#endif
#ifdef USE_BK1088_FM
#define BK1088    1
#else
#define BK1088    0
#endif


#define FM_NUM       RDA5807+CL6017G+BK1080+KT0830EG+QN8035+AR1019+BK1088
#endif  /*  _FM_API_H_   */
